package com.wikilife.index.presenter;

import com.wikilife.index.contract.IndexContract;
import com.wikilife.index.model.IndexBanner;
import com.wikilife.index.model.IndexRecommend;

import java.util.List;

import rx.functions.Action1;

/**
 * Created by Damon.Han on 2017/2/21 0021.
 *
 * @author Damon
 */
public class IndexPresenter extends IndexContract.Presenter {
    @Override
    public void getBannerData() {
        mRxManager.add(mModel.getBanner()
                .subscribe(new Action1<List<IndexBanner>>() {
                    @Override
                    public void call(List<IndexBanner> indexBanner) {
                        mView.showIndexBanner(indexBanner);
                    }
                }));
    }

    @Override
    public void getEntranceData() {

    }

    @Override
    public void getRecommendsData() {
        mRxManager.add(mModel.getRecommends()
                .subscribe(new Action1<List<IndexRecommend>>() {
                    @Override
                    public void call(List<IndexRecommend> indexBanner) {
                        mView.showRecommends(indexBanner);
                    }
                }));
    }

    @Override
    public void onStart() {

    }
}
